#ifndef RESOURCE_MONITOR_H
#define RESOURCE_MONITOR_H

#include <QObject>

class ResourceMonitor : public QObject
{
    Q_OBJECT

public:
    explicit ResourceMonitor(QObject *parent = nullptr);

    // 获取资源使用情况
    double cpuUsage() const;
    double memoryUsage() const;
    double swapUsage() const;
    int cpuFrequency() const;
    int cpuMaxTemperature() const;
    int avgTemperature() const;
    int hddTemperature() const;
    int otherHardwareTemperature() const;

public slots:
    void update(); // 更新所有资源信息

signals:
    void dataUpdated(); // 数据更新信号

private:
    // 资源使用数据
    double m_cpuUsage;
    double m_memoryUsage;
    double m_swapUsage;
    int m_cpuFrequency;
    int m_cpuMaxTemperature;
    int m_avgTemperature;
    int m_hddTemperature;
    int m_otherHardwareTemperature;

    // 更新各个资源信息的私有方法
    void updateCpuUsage();
    void updateMemoryUsage();
    void updateSwapUsage();
    void updateCpuFrequency();
    void updateTemperatures();
    
    // 温度相关辅助方法
    int getCPUMaxTemperature();
    int getAverageTemperature();
    int getHDDTemperature();
    int getOtherHardwareTemperature();
};

#endif // RESOURCE_MONITOR_H